package com.mmy.controller.visa;

import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import com.mmy.controller.Common;
import com.mmy.domain.constzone.TConstZone;
import com.mmy.domain.visa.TVisaBase;
import com.mmy.domain.visa.VVisaBase;
import com.mmy.service.impl.constzone.ConstZoneServiceImpl;
import com.mmy.service.impl.visa.TVisaBaseServiceImpl;
import com.mmy.service.impl.visa.TVisaOrderServiceImpl;
import com.mmy.service.impl.visa.TVisaStuffServiceImpl;
import com.mmy.service.impl.visa.VVisaBaseServiceImpl;

@Controller
public class VisaFrontController {
	
	@Autowired
	TVisaBaseServiceImpl tVisaBaseServiceImpl;
	@Autowired
	ConstZoneServiceImpl constZoneServiceImpl;
	@Autowired
	TVisaOrderServiceImpl tVisaOrderServiceImpl;
	@Autowired
	TVisaStuffServiceImpl tVisaStuffServiceImpl;
	@Autowired
	VVisaBaseServiceImpl vVisaBaseServiceImpl;
	@Autowired
	Common common;
	private static Logger logger = LoggerFactory.getLogger(VisaFrontController.class);
	
	/**
	 * 函数功能说明： 跳转--签证首页
	 *
	 * @param 参数说明 tVisaBase
	 * @return 返回值说明 jsp页面
	 * @throws 异常处理说明
	 * @author 创建人 liys
	 * @date 创建日期 2021.02.24
	 */
	@RequestMapping(value = "/qtvisaindex")
	public String FindAlls(Model model) {
		List<TConstZone> db_TConstZoneCountries = constZoneServiceImpl.findAllCountriess();
		model.addAttribute("countries", db_TConstZoneCountries);
		List<TVisaBase> db_TVisaBase = tVisaBaseServiceImpl.findALL();
		model.addAttribute("visaBase", db_TVisaBase);
		return "visa/visaindex";
	}
	
	/**
	 * 函数功能说明： 跳转--签证基本信息
	 *
	 * @param 参数说明 tVisaBase
	 * @return 返回值说明 jsp页面
	 * @throws 异常处理说明
	 * @author 创建人 hanxl
	 * @date 创建日期 2020.07.29
	 */

	@RequestMapping(value = "/visainfofront")
	public String ToVisaInfo(HttpServletRequest request, Model model) {

		int iVisaID = Integer.parseInt(request.getParameter("visaID"));
		VVisaBase vVisaBase = vVisaBaseServiceImpl.findByVisaID(iVisaID);
		model.addAttribute("vVisaBase", vVisaBase);
		return "visa/visainfo";
	}
	
	/**
	 * 函数功能说明： 跳转--签证预留
	 *
	 * @param 参数说明
	 * @return 返回值说明 jsp页面
	 * @throws 异常处理说明
	 * @author 创建人 shangzl
	 * @date 创建日期
	 */

	@RequestMapping(value = "/reservevisa")
	public String EnterReserveVisa(HttpServletRequest request, Model model) {

		int iVisaID = Integer.parseInt(request.getParameter("iVisaID"));
		VVisaBase vVisaBase = vVisaBaseServiceImpl.findByVisaID(iVisaID);
		model.addAttribute("vVisaBase", vVisaBase);
		model.addAttribute("iVisaID", iVisaID);
		return "visa/reserve";

	}
}
